<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
             <script>
         function sum(O)
         {
             var sumk=0;
             for(var i=1;i<=O;i++)
             {
                 sumk=sumk+i;
             }
             
             return sumk;
         }
            
          function sum1(o1)
          {
            var sumkk=0;
            var j=1;
              for(var k=1;k<=o1;k++)
              {
                 for(var i=k;i>0;i-- )
                 {
                     j=j*i;
                 }
                 sumkk+=j;
                 j=1;
              }
              return sumkk;
          }  
          console.log(sum(3))
          console.log(sum1(3))
             </script>

</body>
</html>